﻿#region Copyright Notice
// This file is part of GestionPedago.
// <description>
// Copyright (C) 2012 ENI Ecole Informatique
// 
// GestionPedago is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// 
// <program> is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
// 
// You should have received a copy of the GNU General Public License
// along with this program.  If not, see <http://www.gnu.org/licenses/>.
#endregion

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using GestionPedago.Services;
using GestionPedago.Services.ES;
using GestionPedago.Services.ES.Modele;

namespace GestionPedago.ViewModel
{
    /// <summary>
    /// Interaction logic for ListViewPlaningPromoStagiaireUC.xaml
    /// </summary>
    public partial class ListViewPlaningPromoStagiaireUC : UserControl
    {


        /// <summary>
        /// Propriété gestionnaire d'onglets
        /// </summary>
        public GestionnaireOngletsVM Parent
        {
            get { return (GestionnaireOngletsVM)GetValue(ParentProperty); }
            set { SetValue(ParentProperty, value); }
        }

        // Using a DependencyProperty as the backing store for Parent.  This enables animation, styling, binding, etc...
        public static readonly DependencyProperty ParentProperty =
            DependencyProperty.Register("Parent", typeof(GestionnaireOngletsVM), typeof(ListViewPlaningPromoStagiaireUC), new PropertyMetadata(null));

        

        /// <summary>
        /// Constructeur de la classe ListViewPlaningPromoStagiaireUC.
        /// </summary>
        public ListViewPlaningPromoStagiaireUC()
        {
            InitializeComponent();
        }

        /// <summary>
        /// Double clique sur un élément de la liste.
        /// </summary>
        private void ListView_MouseDoubleClick_1(object sender, MouseButtonEventArgs e)
        {
            ListView lv = sender as ListView;
            PlanningECFDetailES ped = lv.SelectedItem as PlanningECFDetailES;
            StagiaireES stagiaire = FacadeServices.GetInstance().RecupererStagiaire(new RecupererStagiaireIn(ped.CodeStagiaire)).Stagiaire;
            RechercherListeEvtPedagogiquesIn paramEntree = new RechercherListeEvtPedagogiquesIn();
            paramEntree.CodeStagiaire = ped.CodeStagiaire;
            stagiaire.ListeEvenementPedagogique = FacadeServices.GetInstance().RechercherListeEvtPedagogiques(paramEntree).ListeEvenements;
            Parent.vmMainWindow.CurrentStagiaire = stagiaire;
            
            
            // TODO ouvrir planing par stagiaire
            //CreationModificationECFVM vmCreationModificationECF = new CreationModificationECFVM(Parent, ListViewECFs.SelectedItem as ECFES);
            //Parent.Onglets.Add(vmCreationModificationECF);
            //Parent.SelectedOnglet = vmCreationModificationECF;
        }
    }
}
